package com.hqyj.controller;


import com.hqyj.pojo.Exampaper;
import com.hqyj.pojo.ScoreManagement;
import com.hqyj.service.IScoreManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author rock
 * @since 2021-11-12
 */
@RestController
@RequestMapping("/scoreManagement")
public class ScoreManagementController {

    //注入ScoreManagementService
    @Autowired
    private IScoreManagementService scoreManagementService;

    //加载页面方法
    @RequestMapping(value = "/scoreManagementList",method = RequestMethod.GET)
    public HashMap<String,Object> scoreManagementList(ScoreManagement scoreManagement){
        System.err.println("============scoreManagement================"+scoreManagement);
        return scoreManagementService.select(scoreManagement);
    }

    //求平均分
    @GetMapping("/getAvg")
    public HashMap<String ,Object> getAvg(ScoreManagement scoreManagement){
        System.err.println("=============scoreManagement============="+scoreManagement.getExamTitle());
        return scoreManagementService.getAvg(scoreManagement);

    }

    //求及格率
    @GetMapping("/getPassRate")
    public HashMap<String,Object> getPassRate(){
        HashMap<String,Object> map = new HashMap<>();
        return scoreManagementService.selectPassRate();
    }
}

